package org.jeecgframework.web.service;

import org.jeecgframework.core.common.model.json.AjaxJson;
import org.jeecgframework.core.common.service.CommonService;
import org.jeecgframework.web.system.pojo.base.*;

import javax.servlet.http.HttpServletRequest;
import java.util.Iterator;
import java.util.List;
import java.util.Map;

/**
 * Created by 大伟 on 2017/1/8.
 * Description
 */
public interface WxCommonService extends CommonService {

    static enum ServiceEnum {
        XJYY(1, "巡检预约"),
        GGFX(2, "光管翻新"),
        YQFX(3, "引擎翻新"),
        SBYJ(4, "设备移机"),
        YBSQ(5, "延保申请"),
        KSBX(6, "快速报修"),
        XJBG(7, "巡检变更");

        public int type;

        public String msg;

        ServiceEnum(int type, String msg) {
            this.type = type;
            this.msg = msg;
        }

        public String getMsg() {
            return this.msg;
        }

        public static ServiceEnum getService(int type) {
            for (ServiceEnum serviceEnum : ServiceEnum.values()) {
                if (serviceEnum.type == type) {
                    return serviceEnum;
                }
            }
            return XJYY;
        }
    }

    public String generateServiceId(ServiceEnum type);

    public void sendServiceMail(ServiceEnum type, String id);

    public List<? extends CbsServiceBaseEntity> getList(ServiceEnum type, String phone);

    public List<? extends CbsServiceBaseEntity> getListNew(ServiceEnum type, String phone);

    public TSUser initUserWithPhoneAndName(String phone, String realName, HttpServletRequest request);


    //微信提交完服务单，发送邮件
    void sendMail(CbsServiceEntity service);

    //服务单受理成功，调用第三方接口，加积分
    public void AccRepard(String openid,String type);

    //发送微信模板消息，调用微信接口
    public String sendMsgForWx(List<Map<String,String>> list) throws Exception;
    //用户升级成金牌或者钻石调用微信接口通知微信方
    public String noticeAddLevel(String openId,String type) throws Exception;
    //微信用户提交服务单添加日志
    public void addServiceLog(String serviceId) throws Exception;

    //维修服务单状态变为已完成，如果三日内用户没有评价自动好评（触发执行）
    public void bestEvaluate (String serviceId);

    //维修服务单状态变为已完成，如果三日内用户没有评价自动好评（每天0点执行）
    public void autoBestEvaluate ();


}
